<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交网站导航组件集合</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4285F4;
            --secondary: #8E24AA;
            --light: #F8F9FA;
            --dark: #202124;
            --gray: #5F6368;
            --light-gray: #E8EAED;
            --border-radius: 8px;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            padding-top: 20px;
        }
        
        .section-title {
            font-size: 1.5rem;
            font-weight: 600;
            margin: 2rem 0 1rem;
            padding-bottom: 0.5rem;
            border-bottom: 2px solid var(--primary);
        }
        
        .nav-example {
            margin-bottom: 2rem;
            padding: 1rem;
            border-radius: var(--border-radius);
            background-color: var(--light);
            border: 1px solid var(--light-gray);
        }
        
        /* 顶部导航样式 */
        .top-nav {
            background-color: white;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        /* 侧边导航样式 */
        .sidebar-nav {
            height: 100vh;
            background-color: white;
            border-right: 1px solid var(--light-gray);
            padding-top: 1rem;
        }
        
        .sidebar-nav .nav-link {
            color: var(--gray);
            padding: 0.75rem 1rem;
            border-radius: 0;
        }
        
        .sidebar-nav .nav-link.active {
            background-color: rgba(66, 133, 244, 0.1);
            color: var(--primary);
            border-left: 3px solid var(--primary);
        }
        
        /* 底部导航样式 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid var(--light-gray);
            z-index: 1000;
        }
        
        .bottom-nav .nav-link {
            color: var(--gray);
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 0.5rem;
            font-size: 0.75rem;
        }
        
        .bottom-nav .nav-link i {
            font-size: 1.25rem;
            margin-bottom: 0.25rem;
        }
        
        .bottom-nav .nav-link.active {
            color: var(--primary);
        }
        
        /* 图标导航样式 */
        .icon-nav .nav-link {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0.5rem;
            color: var(--gray);
            background-color: white;
            border: 1px solid var(--light-gray);
        }
        
        .icon-nav .nav-link.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 标签式导航样式 */
        .tab-nav .nav-link {
            color: var(--gray);
            padding: 0.75rem 1.5rem;
        }
        
        .tab-nav .nav-link.active {
            color: var(--primary);
            border-bottom: 2px solid var(--primary);
            background-color: transparent;
            border-radius: 0;
        }
        
        /* 分段式导航 */
        .segmented-nav {
            background-color: white;
            border-radius: 20px;
            padding: 3px;
            display: inline-flex;
        }
        
        .segmented-nav .nav-link {
            color: var(--gray);
            border-radius: 18px;
            padding: 0.5rem 1.25rem;
            margin: 0;
        }
        
        .segmented-nav .nav-link.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 下拉导航 */
        .dropdown-nav .nav-link {
            color: var(--gray);
        }
        
        .dropdown-nav .nav-link.active {
            color: var(--primary);
        }
        
        /* 搜索导航 */
        .search-nav {
            background-color: white;
            padding: 0.5rem 1rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .search-nav .search-input {
            flex: 1;
            border: 1px solid var(--light-gray);
            border-radius: 20px;
            padding: 0.5rem 1rem 0.5rem 2.5rem;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: 0.75rem center;
        }
        
        /* 带用户信息的导航 */
        .user-nav .nav-link {
            color: var(--gray);
        }
        
        .user-nav .nav-link.active {
            color: var(--primary);
        }
        
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        /* 响应式调整 */
        @media (max-width: 768px) {
            .sidebar-nav {
                height: auto;
                border-right: none;
                border-bottom: 1px solid var(--light-gray);
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="mb-4 text-center">社交网站导航组件集合</h1>
        
        <!-- 1. 基础顶部导航 -->
        <div>
            <h2 class="section-title">1. 基础顶部导航</h2>
            <div class="nav-example">
                <nav class="navbar navbar-expand-lg top-nav">
                    <div class="container-fluid">
                        <a class="navbar-brand" href="#">
                            <i class="fas fa-comment-dots text-primary fs-2"></i>
                        </a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#basicNav">
                            <i class="fas fa-bars"></i>
                        </button>
                        <div class="collapse navbar-collapse" id="basicNav">
                            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                                <li class="nav-item">
                                    <a class="nav-link active" aria-current="page" href="#">首页</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">发现</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">消息</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">朋友</a>
                                </li>
                            </ul>
                            <ul class="navbar-nav">
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-bell"></i>
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-user"></i>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
        
        <!-- 2. 侧边栏导航 -->
        <div>
            <h2 class="section-title">2. 侧边栏导航</h2>
            <div class="nav-example">
                <div class="row">
                    <div class="col-md-3">
                        <nav class="sidebar-nav">
                            <ul class="nav flex-column">
                                <li class="nav-item">
                                    <a class="nav-link active" href="#">
                                        <i class="fas fa-home me-2"></i> 首页
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-compass me-2"></i> 发现
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-user-friends me-2"></i> 好友
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-comment me-2"></i> 消息
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-bookmark me-2"></i> 收藏
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-user-circle me-2"></i> 个人主页
                                    </a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-cog me-2"></i> 设置
                                    </a>
                                </li>
                            </ul>
                        </nav>
                    </div>
                    <div class="col-md-9">
                        <div class="p-3 bg-white rounded h-100">
                            主内容区域示例
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 3. 底部导航栏 (移动端常用) -->
        <div>
            <h2 class="section-title">3. 底部导航栏</h2>
            <div class="nav-example" style="padding-bottom: 70px;">
                <div style="height: 200px; background-color: #f0f2f5; border-radius: var(--border-radius);">
                    <!-- 主内容区域 -->
                </div>
                
                <nav class="bottom-nav">
                    <ul class="nav justify-content-around w-100">
                        <li class="nav-item flex-fill text-center">
                            <a class="nav-link active" href="#">
                                <i class="fas fa-home"></i>
                                <span>首页</span>
                            </a>
                        </li>
                        <li class="nav-item flex-fill text-center">
                            <a class="nav-link" href="#">
                                <i class="fas fa-compass"></i>
                                <span>发现</span>
                            </a>
                        </li>
                        <li class="nav-item flex-fill text-center">
                            <a class="nav-link" href="#">
                                <i class="fas fa-plus-circle"></i>
                                <span>发布</span>
                            </a>
                        </li>
                        <li class="nav-item flex-fill text-center">
                            <a class="nav-link" href="#">
                                <i class="fas fa-bell"></i>
                                <span>通知</span>
                            </a>
                        </li>
                        <li class="nav-item flex-fill text-center">
                            <a class="nav-link" href="#">
                                <i class="fas fa-user"></i>
                                <span>我的</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        
        <!-- 4. 图标导航 -->
        <div>
            <h2 class="section-title">4. 图标导航</h2>
            <div class="nav-example">
                <nav class="d-flex justify-content-center icon-nav">
                    <ul class="nav">
                        <li class="nav-item">
                            <a class="nav-link active" href="#" title="首页">
                                <i class="fas fa-home"></i>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" title="搜索">
                                <i class="fas fa-search"></i>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" title="消息">
                                <i class="fas fa-comment"></i>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" title="通知">
                                <i class="fas fa-bell"></i>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#" title="收藏">
                                <i class="fas fa-bookmark"></i>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        
        <!-- 5. 标签式导航 -->
        <div>
            <h2 class="section-title">5. 标签式导航</h2>
            <div class="nav-example">
                <nav class="tab-nav">
                    <ul class="nav border-bottom">
                        <li class="nav-item">
                            <a class="nav-link active" href="#">推荐</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">关注</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">热门</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">最新</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">附近</a>
                        </li>
                    </ul>
                </nav>
                
                <!-- 内容区域示例 -->
                <div class="p-3 mt-3 bg-white rounded">
                    标签内容区域示例
                </div>
            </div>
        </div>
        
        <!-- 6. 分段式导航 -->
        <div>
            <h2 class="section-title">6. 分段式导航</h2>
            <div class="nav-example">
                <div class="d-flex justify-content-center">
                    <nav class="segmented-nav">
                        <ul class="nav">
                            <li class="nav-item">
                                <a class="nav-link active" href="#">全部</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">图片</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">视频</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">文章</a>
                            </li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
        
        <!-- 7. 下拉导航 -->
        <div>
            <h2 class="section-title">7. 下拉导航</h2>
            <div class="nav-example">
                <nav class="navbar navbar-expand-lg top-nav dropdown-nav">
                    <div class="container-fluid">
                        <a class="navbar-brand" href="#">社交平台</a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#dropdownNav">
                            <i class="fas fa-bars"></i>
                        </button>
                        <div class="collapse navbar-collapse" id="dropdownNav">
                            <ul class="navbar-nav me-auto">
                                <li class="nav-item">
                                    <a class="nav-link active" href="#">首页</a>
                                </li>
                                <li class="nav-item dropdown">
                                    <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                        分类
                                    </a>
                                    <ul class="dropdown-menu">
                                        <li><a class="dropdown-item" href="#">美食</a></li>
                                        <li><a class="dropdown-item" href="#">旅行</a></li>
                                        <li><a class="dropdown-item" href="#">音乐</a></li>
                                        <li><a class="dropdown-item" href="#">摄影</a></li>
                                    </ul>
                                </li>
                                <li class="nav-item dropdown">
                                    <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                        活动
                                    </a>
                                    <ul class="dropdown-menu">
                                        <li><a class="dropdown-item" href="#">线上活动</a></li>
                                        <li><a class="dropdown-item" href="#">线下聚会</a></li>
                                        <li><a class="dropdown-item" href="#">创建活动</a></li>
                                    </ul>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">关于我们</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
        
        <!-- 8. 带搜索的导航 -->
        <div>
            <h2 class="section-title">8. 带搜索的导航</h2>
            <div class="nav-example">
                <nav class="search-nav">
                    <div class="container-fluid d-flex align-items-center">
                        <a class="me-3" href="#">
                            <i class="fas fa-comment text-primary fs-2"></i>
                        </a>
                        <input type="text" class="search-input" placeholder="搜索朋友、内容或话题...">
                        <div class="ms-3">
                            <a href="#" class="text-gray mx-2">
                                <i class="fas fa-bell"></i>
                            </a>
                            <a href="#">
                                <i class="fas fa-user-circle"></i>
                            </a>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
        
        <!-- 9. 带用户信息的导航 -->
        <div>
            <h2 class="section-title">9. 带用户信息的导航</h2>
            <div class="nav-example">
                <nav class="navbar navbar-expand-lg top-nav user-nav">
                    <div class="container-fluid">
                        <a class="navbar-brand" href="#">社交圈</a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#userNav">
                            <i class="fas fa-bars"></i>
                        </button>
                        <div class="collapse navbar-collapse" id="userNav">
                            <ul class="navbar-nav me-auto">
                                <li class="nav-item">
                                    <a class="nav-link active" href="#">首页</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">探索</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#">消息</a>
                                </li>
                            </ul>
                            <ul class="navbar-nav d-flex align-items-center">
                                <li class="nav-item me-3">
                                    <a class="nav-link" href="#">
                                        <i class="fas fa-cog"></i>
                                    </a>
                                </li>
                                <li class="nav-item dropdown">
                                    <a class="nav-link dropdown-toggle d-flex align-items-center gap-2" href="#" role="button" data-bs-toggle="dropdown">
                                        <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                                        <span>用户名</span>
                                    </a>
                                    <ul class="dropdown-menu dropdown-menu-end">
                                        <li><a class="dropdown-item" href="#">个人主页</a></li>
                                        <li><a class="dropdown-item" href="#">我的收藏</a></li>
                                        <li><a class="dropdown-item" href="#">设置</a></li>
                                        <li><hr class="dropdown-divider"></li>
                                        <li><a class="dropdown-item" href="#">退出登录</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </div>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 导航交互示例
        document.querySelectorAll('.nav-link').forEach(link => {
            link.addEventListener('click', function(e) {
                // 阻止默认行为，仅用于演示
                if (this.getAttribute('href') === '#') {
                    e.preventDefault();
                }
                
                // 处理激活状态
                const parentNav = this.closest('.nav');
                if (parentNav) {
                    parentNav.querySelectorAll('.nav-link').forEach(item => {
                        item.classList.remove('active');
                    });
                    this.classList.add('active');
                }
            });
        });
    </script>
</body>
</html>
